using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using C1.Win.C1TrueDBGrid;
using PCSComProduction.DCP.BO;
using PCSComUtils.Common;
using PCSComUtils.PCSExc;
using PCSUtils.Log;
using PCSUtils.Utils;

namespace PCSProduction.DCP
{
	/// <summary>
	/// Summary description for ChangeCategoryMatrix.
	/// </summary>
	public class ChangeCategoryMatrix : System.Windows.Forms.Form
	{
		private C1.Win.C1TrueDBGrid.C1TrueDBGrid dgrdData;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.Label lblCCN;
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.TextBox txtCCN;
		private System.Windows.Forms.TextBox txtWorkCenter;
		private System.Windows.Forms.Label lblWorkCenter;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private const string THIS = "PCSProduction.DCP.ChangeCategoryMatrix";
		private DataSet dstData, dstRealData;
		private int intMasterID = 0;
		private System.Windows.Forms.Label lblUM;
		private bool blnHasChange  = false;

		public ChangeCategoryMatrix()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		public ChangeCategoryMatrix(string pstrWorkCenter, string pstrCCN, int pintCCID)
		{
			const string METHOD_NAME = THIS + ".ChangeCategoryMatrix()";
			try
			{
				InitializeComponent();
				txtWorkCenter.Text = pstrWorkCenter;
				txtCCN.Text = pstrCCN;
				intMasterID = pintCCID;
				BindDataToMatrixGrid(pintCCID);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void BindDataToMatrixGrid(int pintChangeCategoryID)
		{
			const string METHOD_NAME = THIS + ".CreateTemplate()";
			try
			{
				DataSet dstInData = new ChangeCategoryBO().List(pintChangeCategoryID);
				if (dstInData.Tables[0].Rows.Count == 0)
				{
					btnSave.Enabled = false;
				}
				string strEmptyCaption = " ";
				dstData	 = new DataSet();
				dstData.Tables.Add(new DataTable());
				dstData.Tables[0].Columns.Add(ITM_ProductTable.PRODUCTID_FLD);
				dstData.Tables[0].Columns.Add(strEmptyCaption);
				foreach (DataRow drowData in dstInData.Tables[0].Rows)
				{
					dstData.Tables[0].Columns.Add(drowData[ITM_ProductTable.PRODUCTID_FLD].ToString(), typeof(int));
				}

				foreach (DataRow drowData in dstInData.Tables[0].Rows)
				{
					DataRow drowNew = dstData.Tables[0].NewRow();
					drowNew[strEmptyCaption] = drowData[ITM_ProductTable.CODE_FLD] + Constants.OPEN_SBRACKET + drowData[ITM_ProductTable.REVISION_FLD].ToString() + Constants.CLOSE_SBRACKET;
					drowNew[ITM_ProductTable.PRODUCTID_FLD] = drowData[ITM_ProductTable.PRODUCTID_FLD];

					dstData.Tables[0].Rows.Add(drowNew);
				}

				dgrdData.DataSource = dstData.Tables[0];
				for(int i =0; i <dgrdData.Splits[0].DisplayColumns.Count; i++)
				{
					if (i > 1)
					{
						dgrdData.Splits[0].DisplayColumns[i].DataColumn.Caption = dstInData.Tables[0].Rows[i - 2][ITM_ProductTable.CODE_FLD].ToString() + Constants.OPEN_SBRACKET + dstInData.Tables[0].Rows[i - 2][ITM_ProductTable.REVISION_FLD].ToString() + Constants.CLOSE_SBRACKET;
						dgrdData.Splits[0].DisplayColumns[i].Style.HorizontalAlignment = AlignHorzEnum.Far;
					}
					dgrdData.Splits[0].DisplayColumns[i].HeadingStyle.HorizontalAlignment = AlignHorzEnum.Center;
					dgrdData.Splits[0].DisplayColumns[i].AutoSize();
					dgrdData.Columns[i].NumberFormat = Constants.INTERGER_NUMBERFORMAT;
				}
				dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.PRODUCTID_FLD].Visible = false;
				dgrdData.Splits[0].DisplayColumns[strEmptyCaption].Style.BackColor = dgrdData.Splits[0].DisplayColumns[0].HeadingStyle.BackColor;
				dgrdData.Splits[0].DisplayColumns[strEmptyCaption].Locked = true;

				//Get all Real data
				dstRealData = new ChangeCategoryBO().ListMatrixByChangeCategoryMasterID(pintChangeCategoryID);
				if (dstRealData.Tables[0].Rows.Count == 0)
				{
					blnHasChange = true;
				}

				for (int i =0; i < dstRealData.Tables[0].Rows.Count; i++)
				{
					dgrdData[GetRowIndexByProductID(int.Parse(dstRealData.Tables[0].Rows[i][PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD].ToString())), dstRealData.Tables[0].Rows[i][PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD].ToString()]
						= dstRealData.Tables[0].Rows[i][PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD].ToString();
				}

				for (int i =0; i < dstInData.Tables[0].Rows.Count; i++)
				{
					for (int j = 0; j <dgrdData.RowCount; j++ )
					{
						if (dgrdData[j, i+2].ToString() == string.Empty)
						{
							dgrdData[j, i+2] = 0;
						}
					}
				}
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}

		private int GetRowIndexByProductID(int pintProductID)
		{
			const string METHOD_NAME = THIS + ".GetRowIndexByProductID()";
			try
			{
				for (int i =0; i < dgrdData.RowCount; i++)
				{
					if (dgrdData[i, ITM_ProductTable.PRODUCTID_FLD].ToString() == pintProductID.ToString())
					{
						return i;
					}
				}
				return 0;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ChangeCategoryMatrix));
			this.txtWorkCenter = new System.Windows.Forms.TextBox();
			this.dgrdData = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
			this.btnSave = new System.Windows.Forms.Button();
			this.lblCCN = new System.Windows.Forms.Label();
			this.lblWorkCenter = new System.Windows.Forms.Label();
			this.btnClose = new System.Windows.Forms.Button();
			this.txtCCN = new System.Windows.Forms.TextBox();
			this.lblUM = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.dgrdData)).BeginInit();
			this.SuspendLayout();
			// 
			// txtWorkCenter
			// 
			this.txtWorkCenter.AccessibleDescription = resources.GetString("txtWorkCenter.AccessibleDescription");
			this.txtWorkCenter.AccessibleName = resources.GetString("txtWorkCenter.AccessibleName");
			this.txtWorkCenter.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtWorkCenter.Anchor")));
			this.txtWorkCenter.AutoSize = ((bool)(resources.GetObject("txtWorkCenter.AutoSize")));
			this.txtWorkCenter.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtWorkCenter.BackgroundImage")));
			this.txtWorkCenter.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtWorkCenter.Dock")));
			this.txtWorkCenter.Enabled = ((bool)(resources.GetObject("txtWorkCenter.Enabled")));
			this.txtWorkCenter.Font = ((System.Drawing.Font)(resources.GetObject("txtWorkCenter.Font")));
			this.txtWorkCenter.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtWorkCenter.ImeMode")));
			this.txtWorkCenter.Location = ((System.Drawing.Point)(resources.GetObject("txtWorkCenter.Location")));
			this.txtWorkCenter.MaxLength = ((int)(resources.GetObject("txtWorkCenter.MaxLength")));
			this.txtWorkCenter.Multiline = ((bool)(resources.GetObject("txtWorkCenter.Multiline")));
			this.txtWorkCenter.Name = "txtWorkCenter";
			this.txtWorkCenter.PasswordChar = ((char)(resources.GetObject("txtWorkCenter.PasswordChar")));
			this.txtWorkCenter.ReadOnly = true;
			this.txtWorkCenter.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtWorkCenter.RightToLeft")));
			this.txtWorkCenter.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtWorkCenter.ScrollBars")));
			this.txtWorkCenter.Size = ((System.Drawing.Size)(resources.GetObject("txtWorkCenter.Size")));
			this.txtWorkCenter.TabIndex = ((int)(resources.GetObject("txtWorkCenter.TabIndex")));
			this.txtWorkCenter.Text = resources.GetString("txtWorkCenter.Text");
			this.txtWorkCenter.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtWorkCenter.TextAlign")));
			this.txtWorkCenter.Visible = ((bool)(resources.GetObject("txtWorkCenter.Visible")));
			this.txtWorkCenter.WordWrap = ((bool)(resources.GetObject("txtWorkCenter.WordWrap")));
			// 
			// dgrdData
			// 
			this.dgrdData.AccessibleDescription = resources.GetString("dgrdData.AccessibleDescription");
			this.dgrdData.AccessibleName = resources.GetString("dgrdData.AccessibleName");
			this.dgrdData.AllowAddNew = ((bool)(resources.GetObject("dgrdData.AllowAddNew")));
			this.dgrdData.AllowArrows = ((bool)(resources.GetObject("dgrdData.AllowArrows")));
			this.dgrdData.AllowColMove = ((bool)(resources.GetObject("dgrdData.AllowColMove")));
			this.dgrdData.AllowColSelect = ((bool)(resources.GetObject("dgrdData.AllowColSelect")));
			this.dgrdData.AllowDelete = ((bool)(resources.GetObject("dgrdData.AllowDelete")));
			this.dgrdData.AllowDrag = ((bool)(resources.GetObject("dgrdData.AllowDrag")));
			this.dgrdData.AllowFilter = ((bool)(resources.GetObject("dgrdData.AllowFilter")));
			this.dgrdData.AllowHorizontalSplit = ((bool)(resources.GetObject("dgrdData.AllowHorizontalSplit")));
			this.dgrdData.AllowRowSelect = ((bool)(resources.GetObject("dgrdData.AllowRowSelect")));
			this.dgrdData.AllowSort = ((bool)(resources.GetObject("dgrdData.AllowSort")));
			this.dgrdData.AllowUpdate = ((bool)(resources.GetObject("dgrdData.AllowUpdate")));
			this.dgrdData.AllowUpdateOnBlur = ((bool)(resources.GetObject("dgrdData.AllowUpdateOnBlur")));
			this.dgrdData.AllowVerticalSplit = ((bool)(resources.GetObject("dgrdData.AllowVerticalSplit")));
			this.dgrdData.AlternatingRows = ((bool)(resources.GetObject("dgrdData.AlternatingRows")));
			this.dgrdData.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dgrdData.Anchor")));
			this.dgrdData.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dgrdData.BackgroundImage")));
			this.dgrdData.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dgrdData.BorderStyle")));
			this.dgrdData.Caption = resources.GetString("dgrdData.Caption");
			this.dgrdData.CaptionHeight = ((int)(resources.GetObject("dgrdData.CaptionHeight")));
			this.dgrdData.CellTipsDelay = ((int)(resources.GetObject("dgrdData.CellTipsDelay")));
			this.dgrdData.CellTipsWidth = ((int)(resources.GetObject("dgrdData.CellTipsWidth")));
			this.dgrdData.ChildGrid = ((C1.Win.C1TrueDBGrid.C1TrueDBGrid)(resources.GetObject("dgrdData.ChildGrid")));
			this.dgrdData.CollapseColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.CollapseColor")));
			this.dgrdData.ColumnFooters = ((bool)(resources.GetObject("dgrdData.ColumnFooters")));
			this.dgrdData.ColumnHeaders = ((bool)(resources.GetObject("dgrdData.ColumnHeaders")));
			this.dgrdData.DefColWidth = ((int)(resources.GetObject("dgrdData.DefColWidth")));
			this.dgrdData.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dgrdData.Dock")));
			this.dgrdData.EditDropDown = ((bool)(resources.GetObject("dgrdData.EditDropDown")));
			this.dgrdData.EmptyRows = ((bool)(resources.GetObject("dgrdData.EmptyRows")));
			this.dgrdData.Enabled = ((bool)(resources.GetObject("dgrdData.Enabled")));
			this.dgrdData.ExpandColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.ExpandColor")));
			this.dgrdData.ExposeCellMode = ((C1.Win.C1TrueDBGrid.ExposeCellModeEnum)(resources.GetObject("dgrdData.ExposeCellMode")));
			this.dgrdData.ExtendRightColumn = ((bool)(resources.GetObject("dgrdData.ExtendRightColumn")));
			this.dgrdData.FetchRowStyles = ((bool)(resources.GetObject("dgrdData.FetchRowStyles")));
			this.dgrdData.FilterBar = ((bool)(resources.GetObject("dgrdData.FilterBar")));
			this.dgrdData.FlatStyle = ((C1.Win.C1TrueDBGrid.FlatModeEnum)(resources.GetObject("dgrdData.FlatStyle")));
			this.dgrdData.Font = ((System.Drawing.Font)(resources.GetObject("dgrdData.Font")));
			this.dgrdData.GroupByAreaVisible = ((bool)(resources.GetObject("dgrdData.GroupByAreaVisible")));
			this.dgrdData.GroupByCaption = resources.GetString("dgrdData.GroupByCaption");
			this.dgrdData.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
			this.dgrdData.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dgrdData.ImeMode")));
			this.dgrdData.LinesPerRow = ((int)(resources.GetObject("dgrdData.LinesPerRow")));
			this.dgrdData.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.Location")));
			this.dgrdData.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
			this.dgrdData.Name = "dgrdData";
			this.dgrdData.PictureAddnewRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureAddnewRow")));
			this.dgrdData.PictureCurrentRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureCurrentRow")));
			this.dgrdData.PictureFilterBar = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFilterBar")));
			this.dgrdData.PictureFooterRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFooterRow")));
			this.dgrdData.PictureHeaderRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureHeaderRow")));
			this.dgrdData.PictureModifiedRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureModifiedRow")));
			this.dgrdData.PictureStandardRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureStandardRow")));
			this.dgrdData.PreviewInfo.AllowSizing = ((bool)(resources.GetObject("dgrdData.PreviewInfo.AllowSizing")));
			this.dgrdData.PreviewInfo.Caption = resources.GetString("dgrdData.PreviewInfo.Caption");
			this.dgrdData.PreviewInfo.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.PreviewInfo.Location")));
			this.dgrdData.PreviewInfo.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.PreviewInfo.Size")));
			this.dgrdData.PreviewInfo.ToolBars = ((bool)(resources.GetObject("dgrdData.PreviewInfo.ToolBars")));
			this.dgrdData.PreviewInfo.UIStrings.Content = ((string[])(resources.GetObject("dgrdData.PreviewInfo.UIStrings.Content")));
			this.dgrdData.PreviewInfo.ZoomFactor = ((System.Double)(resources.GetObject("dgrdData.PreviewInfo.ZoomFactor")));
			this.dgrdData.PrintInfo.MaxRowHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.MaxRowHeight")));
			this.dgrdData.PrintInfo.OwnerDrawPageFooter = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageFooter")));
			this.dgrdData.PrintInfo.OwnerDrawPageHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageHeader")));
			this.dgrdData.PrintInfo.PageFooter = resources.GetString("dgrdData.PrintInfo.PageFooter");
			this.dgrdData.PrintInfo.PageFooterHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageFooterHeight")));
			this.dgrdData.PrintInfo.PageHeader = resources.GetString("dgrdData.PrintInfo.PageHeader");
			this.dgrdData.PrintInfo.PageHeaderHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageHeaderHeight")));
			this.dgrdData.PrintInfo.PrintHorizontalSplits = ((bool)(resources.GetObject("dgrdData.PrintInfo.PrintHorizontalSplits")));
			this.dgrdData.PrintInfo.ProgressCaption = resources.GetString("dgrdData.PrintInfo.ProgressCaption");
			this.dgrdData.PrintInfo.RepeatColumnFooters = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnFooters")));
			this.dgrdData.PrintInfo.RepeatColumnHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnHeaders")));
			this.dgrdData.PrintInfo.RepeatGridHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatGridHeader")));
			this.dgrdData.PrintInfo.RepeatSplitHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatSplitHeaders")));
			this.dgrdData.PrintInfo.ShowOptionsDialog = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowOptionsDialog")));
			this.dgrdData.PrintInfo.ShowProgressForm = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowProgressForm")));
			this.dgrdData.PrintInfo.ShowSelection = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowSelection")));
			this.dgrdData.PrintInfo.UseGridColors = ((bool)(resources.GetObject("dgrdData.PrintInfo.UseGridColors")));
			this.dgrdData.RecordSelectors = ((bool)(resources.GetObject("dgrdData.RecordSelectors")));
			this.dgrdData.RecordSelectorWidth = ((int)(resources.GetObject("dgrdData.RecordSelectorWidth")));
			this.dgrdData.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dgrdData.RightToLeft")));
			this.dgrdData.RowDivider.Color = ((System.Drawing.Color)(resources.GetObject("resource.Color")));
			this.dgrdData.RowDivider.Style = ((C1.Win.C1TrueDBGrid.LineStyleEnum)(resources.GetObject("resource.Style")));
			this.dgrdData.RowHeight = ((int)(resources.GetObject("dgrdData.RowHeight")));
			this.dgrdData.RowSubDividerColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.RowSubDividerColor")));
			this.dgrdData.ScrollTips = ((bool)(resources.GetObject("dgrdData.ScrollTips")));
			this.dgrdData.ScrollTrack = ((bool)(resources.GetObject("dgrdData.ScrollTrack")));
			this.dgrdData.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.Size")));
			this.dgrdData.SpringMode = ((bool)(resources.GetObject("dgrdData.SpringMode")));
			this.dgrdData.TabAcrossSplits = ((bool)(resources.GetObject("dgrdData.TabAcrossSplits")));
			this.dgrdData.TabIndex = ((int)(resources.GetObject("dgrdData.TabIndex")));
			this.dgrdData.Text = resources.GetString("dgrdData.Text");
			this.dgrdData.ViewCaptionWidth = ((int)(resources.GetObject("dgrdData.ViewCaptionWidth")));
			this.dgrdData.ViewColumnWidth = ((int)(resources.GetObject("dgrdData.ViewColumnWidth")));
			this.dgrdData.Visible = ((bool)(resources.GetObject("dgrdData.Visible")));
			this.dgrdData.WrapCellPointer = ((bool)(resources.GetObject("dgrdData.WrapCellPointer")));
			this.dgrdData.BeforeColEdit += new C1.Win.C1TrueDBGrid.BeforeColEditEventHandler(this.dgrdData_BeforeColEdit);
			this.dgrdData.AfterColEdit += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_AfterColEdit);
			this.dgrdData.BeforeColUpdate += new C1.Win.C1TrueDBGrid.BeforeColUpdateEventHandler(this.dgrdData_BeforeColUpdate);
			this.dgrdData.PropBag = resources.GetString("dgrdData.PropBag");
			// 
			// btnSave
			// 
			this.btnSave.AccessibleDescription = resources.GetString("btnSave.AccessibleDescription");
			this.btnSave.AccessibleName = resources.GetString("btnSave.AccessibleName");
			this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnSave.Anchor")));
			this.btnSave.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSave.BackgroundImage")));
			this.btnSave.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnSave.Dock")));
			this.btnSave.Enabled = ((bool)(resources.GetObject("btnSave.Enabled")));
			this.btnSave.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnSave.FlatStyle")));
			this.btnSave.Font = ((System.Drawing.Font)(resources.GetObject("btnSave.Font")));
			this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
			this.btnSave.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.ImageAlign")));
			this.btnSave.ImageIndex = ((int)(resources.GetObject("btnSave.ImageIndex")));
			this.btnSave.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnSave.ImeMode")));
			this.btnSave.Location = ((System.Drawing.Point)(resources.GetObject("btnSave.Location")));
			this.btnSave.Name = "btnSave";
			this.btnSave.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnSave.RightToLeft")));
			this.btnSave.Size = ((System.Drawing.Size)(resources.GetObject("btnSave.Size")));
			this.btnSave.TabIndex = ((int)(resources.GetObject("btnSave.TabIndex")));
			this.btnSave.Text = resources.GetString("btnSave.Text");
			this.btnSave.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.TextAlign")));
			this.btnSave.Visible = ((bool)(resources.GetObject("btnSave.Visible")));
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// lblCCN
			// 
			this.lblCCN.AccessibleDescription = resources.GetString("lblCCN.AccessibleDescription");
			this.lblCCN.AccessibleName = resources.GetString("lblCCN.AccessibleName");
			this.lblCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCCN.Anchor")));
			this.lblCCN.AutoSize = ((bool)(resources.GetObject("lblCCN.AutoSize")));
			this.lblCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCCN.Dock")));
			this.lblCCN.Enabled = ((bool)(resources.GetObject("lblCCN.Enabled")));
			this.lblCCN.Font = ((System.Drawing.Font)(resources.GetObject("lblCCN.Font")));
			this.lblCCN.ForeColor = System.Drawing.SystemColors.ControlText;
			this.lblCCN.Image = ((System.Drawing.Image)(resources.GetObject("lblCCN.Image")));
			this.lblCCN.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.ImageAlign")));
			this.lblCCN.ImageIndex = ((int)(resources.GetObject("lblCCN.ImageIndex")));
			this.lblCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCCN.ImeMode")));
			this.lblCCN.Location = ((System.Drawing.Point)(resources.GetObject("lblCCN.Location")));
			this.lblCCN.Name = "lblCCN";
			this.lblCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCCN.RightToLeft")));
			this.lblCCN.Size = ((System.Drawing.Size)(resources.GetObject("lblCCN.Size")));
			this.lblCCN.TabIndex = ((int)(resources.GetObject("lblCCN.TabIndex")));
			this.lblCCN.Text = resources.GetString("lblCCN.Text");
			this.lblCCN.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.TextAlign")));
			this.lblCCN.Visible = ((bool)(resources.GetObject("lblCCN.Visible")));
			// 
			// lblWorkCenter
			// 
			this.lblWorkCenter.AccessibleDescription = resources.GetString("lblWorkCenter.AccessibleDescription");
			this.lblWorkCenter.AccessibleName = resources.GetString("lblWorkCenter.AccessibleName");
			this.lblWorkCenter.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblWorkCenter.Anchor")));
			this.lblWorkCenter.AutoSize = ((bool)(resources.GetObject("lblWorkCenter.AutoSize")));
			this.lblWorkCenter.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblWorkCenter.Dock")));
			this.lblWorkCenter.Enabled = ((bool)(resources.GetObject("lblWorkCenter.Enabled")));
			this.lblWorkCenter.Font = ((System.Drawing.Font)(resources.GetObject("lblWorkCenter.Font")));
			this.lblWorkCenter.ForeColor = System.Drawing.SystemColors.ControlText;
			this.lblWorkCenter.Image = ((System.Drawing.Image)(resources.GetObject("lblWorkCenter.Image")));
			this.lblWorkCenter.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblWorkCenter.ImageAlign")));
			this.lblWorkCenter.ImageIndex = ((int)(resources.GetObject("lblWorkCenter.ImageIndex")));
			this.lblWorkCenter.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblWorkCenter.ImeMode")));
			this.lblWorkCenter.Location = ((System.Drawing.Point)(resources.GetObject("lblWorkCenter.Location")));
			this.lblWorkCenter.Name = "lblWorkCenter";
			this.lblWorkCenter.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblWorkCenter.RightToLeft")));
			this.lblWorkCenter.Size = ((System.Drawing.Size)(resources.GetObject("lblWorkCenter.Size")));
			this.lblWorkCenter.TabIndex = ((int)(resources.GetObject("lblWorkCenter.TabIndex")));
			this.lblWorkCenter.Text = resources.GetString("lblWorkCenter.Text");
			this.lblWorkCenter.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblWorkCenter.TextAlign")));
			this.lblWorkCenter.Visible = ((bool)(resources.GetObject("lblWorkCenter.Visible")));
			// 
			// btnClose
			// 
			this.btnClose.AccessibleDescription = resources.GetString("btnClose.AccessibleDescription");
			this.btnClose.AccessibleName = resources.GetString("btnClose.AccessibleName");
			this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnClose.Anchor")));
			this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
			this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnClose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnClose.Dock")));
			this.btnClose.Enabled = ((bool)(resources.GetObject("btnClose.Enabled")));
			this.btnClose.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnClose.FlatStyle")));
			this.btnClose.Font = ((System.Drawing.Font)(resources.GetObject("btnClose.Font")));
			this.btnClose.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
			this.btnClose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.ImageAlign")));
			this.btnClose.ImageIndex = ((int)(resources.GetObject("btnClose.ImageIndex")));
			this.btnClose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnClose.ImeMode")));
			this.btnClose.Location = ((System.Drawing.Point)(resources.GetObject("btnClose.Location")));
			this.btnClose.Name = "btnClose";
			this.btnClose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnClose.RightToLeft")));
			this.btnClose.Size = ((System.Drawing.Size)(resources.GetObject("btnClose.Size")));
			this.btnClose.TabIndex = ((int)(resources.GetObject("btnClose.TabIndex")));
			this.btnClose.Text = resources.GetString("btnClose.Text");
			this.btnClose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.TextAlign")));
			this.btnClose.Visible = ((bool)(resources.GetObject("btnClose.Visible")));
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// txtCCN
			// 
			this.txtCCN.AccessibleDescription = resources.GetString("txtCCN.AccessibleDescription");
			this.txtCCN.AccessibleName = resources.GetString("txtCCN.AccessibleName");
			this.txtCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtCCN.Anchor")));
			this.txtCCN.AutoSize = ((bool)(resources.GetObject("txtCCN.AutoSize")));
			this.txtCCN.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtCCN.BackgroundImage")));
			this.txtCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtCCN.Dock")));
			this.txtCCN.Enabled = ((bool)(resources.GetObject("txtCCN.Enabled")));
			this.txtCCN.Font = ((System.Drawing.Font)(resources.GetObject("txtCCN.Font")));
			this.txtCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtCCN.ImeMode")));
			this.txtCCN.Location = ((System.Drawing.Point)(resources.GetObject("txtCCN.Location")));
			this.txtCCN.MaxLength = ((int)(resources.GetObject("txtCCN.MaxLength")));
			this.txtCCN.Multiline = ((bool)(resources.GetObject("txtCCN.Multiline")));
			this.txtCCN.Name = "txtCCN";
			this.txtCCN.PasswordChar = ((char)(resources.GetObject("txtCCN.PasswordChar")));
			this.txtCCN.ReadOnly = true;
			this.txtCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtCCN.RightToLeft")));
			this.txtCCN.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtCCN.ScrollBars")));
			this.txtCCN.Size = ((System.Drawing.Size)(resources.GetObject("txtCCN.Size")));
			this.txtCCN.TabIndex = ((int)(resources.GetObject("txtCCN.TabIndex")));
			this.txtCCN.Text = resources.GetString("txtCCN.Text");
			this.txtCCN.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtCCN.TextAlign")));
			this.txtCCN.Visible = ((bool)(resources.GetObject("txtCCN.Visible")));
			this.txtCCN.WordWrap = ((bool)(resources.GetObject("txtCCN.WordWrap")));
			// 
			// lblUM
			// 
			this.lblUM.AccessibleDescription = resources.GetString("lblUM.AccessibleDescription");
			this.lblUM.AccessibleName = resources.GetString("lblUM.AccessibleName");
			this.lblUM.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblUM.Anchor")));
			this.lblUM.AutoSize = ((bool)(resources.GetObject("lblUM.AutoSize")));
			this.lblUM.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblUM.Dock")));
			this.lblUM.Enabled = ((bool)(resources.GetObject("lblUM.Enabled")));
			this.lblUM.Font = ((System.Drawing.Font)(resources.GetObject("lblUM.Font")));
			this.lblUM.Image = ((System.Drawing.Image)(resources.GetObject("lblUM.Image")));
			this.lblUM.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblUM.ImageAlign")));
			this.lblUM.ImageIndex = ((int)(resources.GetObject("lblUM.ImageIndex")));
			this.lblUM.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblUM.ImeMode")));
			this.lblUM.Location = ((System.Drawing.Point)(resources.GetObject("lblUM.Location")));
			this.lblUM.Name = "lblUM";
			this.lblUM.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblUM.RightToLeft")));
			this.lblUM.Size = ((System.Drawing.Size)(resources.GetObject("lblUM.Size")));
			this.lblUM.TabIndex = ((int)(resources.GetObject("lblUM.TabIndex")));
			this.lblUM.Text = resources.GetString("lblUM.Text");
			this.lblUM.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblUM.TextAlign")));
			this.lblUM.Visible = ((bool)(resources.GetObject("lblUM.Visible")));
			// 
			// ChangeCategoryMatrix
			// 
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.CancelButton = this.btnClose;
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.lblUM);
			this.Controls.Add(this.txtCCN);
			this.Controls.Add(this.txtWorkCenter);
			this.Controls.Add(this.btnClose);
			this.Controls.Add(this.dgrdData);
			this.Controls.Add(this.btnSave);
			this.Controls.Add(this.lblCCN);
			this.Controls.Add(this.lblWorkCenter);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.KeyPreview = true;
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
			this.Name = "ChangeCategoryMatrix";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
			this.Text = resources.GetString("$this.Text");
			this.Closing += new System.ComponentModel.CancelEventHandler(this.ChangeCategoryMatrix_Closing);
			this.Load += new System.EventHandler(this.ChangeCategoryMatrix_Load);
			((System.ComponentModel.ISupportInitialize)(this.dgrdData)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void ChangeCategoryMatrix_Load(object sender, System.EventArgs e)
		{
			dgrdData.RowHeight = Constants.DEFAULT_ROW_HEIGHT;
			dgrdData.MarqueeStyle = MarqueeEnum.HighlightCell;
			dgrdData.HighLightRowStyle.BackColor = Color.FromArgb((byte)Constants.BACKGROUND_COLOUR_R, (byte)Constants.BACKGROUND_COLOUR_G, (byte)Constants.BACKGROUND_COLOUR_B);
			dgrdData.HighLightRowStyle.ForeColor = Color.FromArgb((byte)Constants.FORE_COLOUR_R, (byte)Constants.FORE_COLOUR_R, (byte)Constants.FORE_COLOUR_R);
			dgrdData.Style.VerticalAlignment =  C1.Win.C1TrueDBGrid.AlignVertEnum.Center;
			if(dgrdData.Splits.Count > 0)
			{
				// Set default alignment
				foreach(C1DisplayColumn c1Column in dgrdData.Splits[0].DisplayColumns)
				{
					c1Column.HeadingStyle.HorizontalAlignment =  C1.Win.C1TrueDBGrid.AlignHorzEnum.Center;
				}
			}
			dgrdData.Splits[0].DisplayColumns[1].AllowFocus = false;
			// Not allow user change column order
			dgrdData.AllowColMove = false;
			dgrdData.Refresh();
			btnSave.Visible = true;
			// this.MaximizeBox = false;
		}

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = ".btnSave_Click()";
			try
			{
				if (dgrdData.EditActive) return;
				dstRealData.Tables[0].Rows.Clear();
				dstRealData.Tables[0].AcceptChanges();

				//get data from grid
				for (int i =0; i <dstData.Tables[0].Rows.Count; i++)
				{
					for (int j =0; j <dstData.Tables[0].Rows.Count; j++)
					{
						DataRow drow = dstRealData.Tables[0].NewRow();
						drow[PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD] = dstData.Tables[0].Rows[i][ITM_ProductTable.PRODUCTID_FLD];
						drow[PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD] = dstData.Tables[0].Rows[j][ITM_ProductTable.PRODUCTID_FLD];;
						drow[PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD] = dgrdData[i, dstData.Tables[0].Rows[j][ITM_ProductTable.PRODUCTID_FLD].ToString()];
						drow[PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_FLD] = intMasterID;
						dstRealData.Tables[0].Rows.Add(drow);
					}
				}

				new ChangeCategoryBO().UpdateDataSetMatrix(dstRealData, intMasterID);
				PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA);
				blnHasChange = false;
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			if (dgrdData.EditActive) return;
			this.Close();
		}

		private void dgrdData_BeforeColUpdate(object sender, C1.Win.C1TrueDBGrid.BeforeColUpdateEventArgs e)
		{
			const string METHOD_NAME = ".dgrdData_BeforeColUpdate()";
			try
			{
//				try
//				{
//					if (int.Parse(e.Column.DataColumn.Value.ToString()) < 0)
//					{
//						e.Cancel = true;
//						PCSMessageBox.Show(ErrorCode.MESSAGE_CHANGECATEGORY_CHANGETIME, MessageBoxIcon.Error);
//					}
//				}
//				catch
//				{
//					e.Cancel = true;
//					PCSMessageBox.Show(ErrorCode.MESSAGE_CHANGECATEGORY_CHANGETIME, MessageBoxIcon.Error);
//				}
				if (dgrdData.Columns[e.Column.DataColumn.DataField].Text.Trim() != string.Empty)
				{
					if (e.Column.DataColumn.Text == string.Empty)
					{
						return;
					}
					try
					{
						if (decimal.Parse(e.Column.DataColumn.Text) < 0)
						{
							PCSMessageBox.Show(ErrorCode.MESSAGE_CHANGECATEGORY_CHANGETIME, MessageBoxIcon.Warning);
							e.Cancel = true;
						}
					}
					catch
					{
						e.Cancel = true;
					}
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void ChangeCategoryMatrix_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".ChangeCategoryMatrix_Closing()";
			try
			{
				if (blnHasChange)
				{
					DialogResult confirmDialog = PCSMessageBox.Show(ErrorCode.MESSAGE_QUESTION_STORE_INTO_DATABASE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
					switch (confirmDialog)
					{
						case DialogResult.Yes:
							//Save before exit
							btnSave_Click(btnSave, new EventArgs());
							break;
						case DialogResult.No:
							break;
						case DialogResult.Cancel:
							e.Cancel = true;
							break;
					}
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void dgrdData_AfterColEdit(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)
		{
			const string METHOD_NAME = ".dgrdData_AfterColEdit()";
			try
			{
				blnHasChange = true;
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void dgrdData_BeforeColEdit(object sender, C1.Win.C1TrueDBGrid.BeforeColEditEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_BeforeColEdit()";
			try
			{
				if (e.Column.DataColumn.DataField == dgrdData[dgrdData.Row, ITM_ProductTable.PRODUCTID_FLD].ToString())
				{
					e.Cancel = true;
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}
	}
}
